Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sequent-promises

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sequent-promises

sequentPromises resolves Promises sequentially

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.1K
increased by24.86%
Maintainers
1
Weekly downloads
 
Created
Source

sequent-promises

npm npm bundle size

Call promises one by one, ignoring the state (fulfilled or rejected). and returning the collected data in the tuple { results, errors }.

Install

npm

npm install sequent-promises

yarn

yarn add sequent-promises

Usage

import sequentPromises, { isNotRunningError } from 'sequent-promises';

const result = 'result';
const error = new Error('error');
const promiseResolve = () => Promise.resolve(result);
const promiseReject = () => Promise.reject(error);

sequentPromises([promiseResolve, promiseReject, promiseResolve, isSuccessful, isError]).then(
  ({ success, errors, results }) => {
    console.log(success); // [result, result]
    console.log(errors); // ['Not running: Promise was not running']
    console.log(results); // [result, 'Not running: Promise was not running', result]
    console.log(isSuccessful); // true - last promise
    console.log(isError); // false - last promise
    console.log(isNotRunningError(errors[0])); //true;
  },
);

Run tests

npm test

Maintainer

Krivega Dmitriy

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

📝 License

Copyright © 2020 Krivega Dmitriy.
This project is MIT licensed.

Keywords

FAQs

Package last updated on 12 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc